package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduSchool.EduSchoolVO;
import com.jwsoft.manager.common.vo.eduSchoolBb.EduSchoolBbKeyVO;
import com.jwsoft.manager.common.vo.eduSchoolBb.EduSchoolBbQueryVO;
import com.jwsoft.manager.common.vo.eduSchoolBb.EduSchoolBbVO;
import com.jwsoft.manager.core.integration.EduSchoolBbIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 可补报学校表网关
 *
 * @author wangtao
 * @since 2022-12-19
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "可补报学校表", description = "可补报学校表")
public class EduSchoolBbController {

    @Autowired
    public EduSchoolBbIntegration eduSchoolBbIntegration;

    @Operation(summary = "可补报学校表分页查询",description = "可补报学校表分页查询")
    @PostMapping(value = "/eduSchoolBb0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSchoolBbVO>> getList(@RequestBody @Validated EduSchoolBbQueryVO vo) {
        return AppResponse.successData(eduSchoolBbIntegration.getList(vo));
    }

    @Operation(summary = "可补报学校表根据主键查询详情",description = "可补报学校表根据主键查询详情")
    @PostMapping(value = "/eduSchoolBb0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolBbVO> getById(@RequestBody @Validated EduSchoolBbKeyVO vo) {
        return AppResponse.successData(eduSchoolBbIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "可补报学校表新增",description = "可补报学校表新增")
    @PostMapping(value = "/eduSchoolBb0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolBbVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSchoolBbVO vo) {
        return AppResponse.successData(eduSchoolBbIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "可补报学校表修改",description = "可补报学校表修改")
    @PostMapping(value = "/eduSchoolBb0005", produces = "application/json;charset=UTF-8")
    public AppResponse edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSchoolBbVO vo) {
        eduSchoolBbIntegration.edit(vo);
        return AppResponse.successMsg("修改成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "可补报学校表删除",description = "可补报学校表删除")
    @PostMapping(value = "/eduSchoolBb0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSchoolBbKeyVO vo) {
        eduSchoolBbIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Operation(summary = "查询未补报公办学校列表",description = "查询未补报公办学校列表")
    @PostMapping(value = "/eduSchoolBb0007", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSchoolVO>> getSchoolBbList(@RequestBody @Validated EduSchoolBbQueryVO vo) {
        return AppResponse.successData(eduSchoolBbIntegration.getSchoolBbList(vo));
    }

}
